package com.allwees.bs.c.module.product.repository;

import com.allwees.bs.c.module.base.repository.BaseRepository;
import com.allwees.bs.c.module.product.entity.CategoryEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CategoryRepository extends BaseRepository<CategoryEntity, Integer> {

	@Query(value = "select c.no FROM CategoryEntity c WHERE c.isDeleted = 0 AND c.status = 0 AND c.parentNo = :parentNo  ORDER BY c.idx")
	List<String> findChildCategoryNos(@Param("parentNo") String parentNo);

	@Query(value = "SELECT c FROM CategoryEntity c WHERE c.isDeleted = 0 AND c.status = 0 AND c.parentNo = :parentNo ORDER BY c.idx")
	List<CategoryEntity> findChildCategories(@Param("parentNo") String parentNo);
}
